.card {
	background-color: $white;
	border-radius: 2px;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
	display: block;
	display: flex;
	margin-top: $margin-md;
	margin-bottom: $margin-md;
	transition: box-shadow 0.3s $timing;
	position: relative;
	&[class*="-bg"] {
		color: $white;
	}
	.card-wrap & {
		margin-top: 0;
	}
	// no boxshadow
		.no-boxshadow & {
			border: 1px solid $black-bg;
		}
	// no flexbox
		.no-flexbox & {
			@include clearfix();
		}
}

// colour
	.card-offwhite {
		background-color: $white-bg;
	}

	@each $color in $palette-list {
		$i: index($palette-list, $color);

		.card-#{$color} {
			box-shadow: 0 0 2px rgba(0, 0, 0, 0.3), 0 1px 6px rgba(red(nth($palette-color, $i)), green(nth($palette-color, $i)), blue(nth($palette-color, $i)), 0.3);
			// no boxshadow
				.no-boxshadow & {
					border-color: nth($palette-color-light, $i);
				}
		}

		.card-#{$color}-bg {
			@extend .card-#{$color};
			background-color: nth($palette-color, $i);
		}
	}

.card-action {
	border-top: 1px solid $black-bg;
	position: relative;
	@include clearfix();
	&:first-child {
		border-top: 0;
	}
	.nav {
		margin-top: 0;
		margin-bottom: 0;
		> li {
			> a,
			> .a {
				color: $black-sec;
				&:focus,
				&:hover {
					color: $link-color;
				}
				.card[class*="-bg"] & {
					color: $white;
				}
			}
			&.active >,
			&.open > {
				a,
				.a {
					color: $link-color;
				}
			}
		}
	}
}

// colour
	@each $color in $palette-list {
		$i: index($palette-list, $color);

		.card-#{$color} .card-action {
			border-top-color: nth($palette-color-light, $i);
		}

		.card-#{$color}-bg .card-action {
			border-top-color: nth($palette-color-dark-m, $i);
		}
	}

.card-header {
	border-bottom: 1px solid $black-bg;
	display: block;
	display: flex;
	min-height: $header-height;
	position: relative;
	// no flexbox
		.no-flexbox & {
			@include clearfix();
		}
}

.card-header-side {
	vertical-align: middle;
	padding-top: (($header-height - $line-height) / 2);
	padding-bottom: (($header-height - $line-height) / 2);
	&.pull-left {
		order: -1;
		padding-left: $grid-gutter;
		// no flexbox
			.no-flexbox & {
				padding-right: $grid-gutter;
			}
	}
	&.pull-right {
		order: 1;
		padding-right: $grid-gutter;
		// no flexbox
			.no-flexbox & {
				padding-left: $grid-gutter;
			}
	}
}

.card-heading {
	display: block;
	font-size: $font-size-h4;
	line-height: $line-height-h4;
	margin-top: $margin-md;
	margin-bottom: $margin-md;
	.card-header & {
		margin-top: 0;
		margin-bottom: 0;
	}
}

.card-img {
	overflow: hidden;
	position: relative;
	&:first-child {
		border-radius: 2px 2px 0 0;
	}
	&:last-child {
		border-radius: 0 0 2px 2px;
	}
	img {
		display: block;
		height: auto;
		width: 100%;
	}
}

.card-img-heading {
	background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
	color: $white;
	font-size: $font-size-h4;
	line-height: $line-height-h4;
	margin: 0;
	padding: $margin-sm $grid-gutter;
	position: absolute;
		bottom: 0;
		left: 0;
	width: 100%;
}

.card-inner {
	margin: $margin-md $grid-gutter;
	position: relative;
	.card-header & {
		flex: 1;
		font-size: $font-size-h5;
		line-height: $line-height-h5;
		margin-top: (($header-height - $line-height-h5) / 2);
		margin-bottom: (($header-height - $line-height-h5) / 2);
	}
	// no flexbox
		.no-flexbox .card-header-side + & {
			overflow: hidden;
		}
}

.card-main {
	flex: 1;
	// no flexbox
		.no-flexbox .card-side ~ & {
			overflow: hidden;
		}
}

// colour
	@each $color in $palette-list {
		$i: index($palette-list, $color);

		.card-#{$color}-bg .card-main a {
			color: nth($palette-color-light, $i);
		}
	}

.card-side {
	background-color: $white-bg;
	border-radius: 2px 0 0 2px;
	max-width: 33.33333%;
	padding-right: $grid-gutter;
	padding-left: $grid-gutter;
	&[href] {
		color: $black-text;
		&:focus,
		&:hover {
			background-color: $white-bg-dark;
			text-decoration: none;
		}
	}
	&.card-side-img {
		overflow: hidden;
		padding-right: 0;
		padding-left: 0;
	}
	&.pull-right {
		border-radius: 0 2px 2px 0;
		order: 1;
	}
}

// colour
	.card-offwhite .card-side {
		background-color: $white-bg-dark;
	}

	@each $color in $palette-list {
		$i: index($palette-list, $color);

		.card-side {
			.card-#{$color} & {
				background-color: nth($palette-color, $i);
				color: $white;
				&[href] {
					&:focus,
					&:hover {
						background-color: nth($palette-color-dark-m, $i);
					}
				}
			}
			.card-#{$color}-bg & {
				background-color: nth($palette-color-dark-m, $i);
				&[href] {
					&:focus,
					&:hover {
						background-color: nth($palette-color-dark, $i);
					}
				}
			}
		}
	}

.card-wrap {
	margin-top: $margin-md;
	margin-bottom: ($margin-md * -1);
	@include clearfix();
}
